Ext.define('HIT.controller.Foot',{
	extend:'Ext.app.Controller',
	views:['FootPanel','EditionInfoWin'],
	
	onButtonClick: function(button, e, options) {
		
		if(button.id =='edition-button'){
			p = Share.createPanelByAlias('widget.editioninfowin');
			Share.showPanelAsWindow(p);
			Share.AjaxRequest({
				url : ctx + "/geteditioninfo", 
       			params : {},
       			callback : function(json) {
       				Ext.ComponentMgr.get("editionname").setText(json.customer);
       				Ext.ComponentMgr.get("edinionendtime").setText(json.expired);
       				Ext.ComponentMgr.get("edinionmaxcustome").setText(json.maxcustomer);
       				Ext.ComponentMgr.get("edinionmaxcompany").setText(json.maxcompany);
       			}
			});
		}
		
		if(button.id == 'help-button'){
//			Ext.MessageBox.alert("HELP");
//			document.location.href="http://www.zhuoda.org/lunzi/66097.html";
			var TabPanel = Ext.getCmp("centertabpanel");
			var ID = TabPanel.getActiveTab().id;
			if(ID == 'tab-set-transtype' || ID == 'tab-set-vattype' || ID == 'tab-set-businesstype' || 
			   ID== 'tab-set-exporttype'){
				ID = 'tab-set-normaltype';
			}
//			var temp = TabPanel.getActiveTab();
			var NAME = ID.substr(4,3);
//			console.log(TabPanel.getActiveTab().title+":"+ID);
//			window.open("http://www.jb51.net/article/23425.htm#top"); 
//			window.open("/TAX/resources/help/Tax 6.1 plus用户手册.htm"+"#"+ID);
//			window.open("/TAX/resources/help/FAS.htm");
//			window.open("/TAX/resources/help/HelpDocument.htm"+"#"+ID);
			/**
			 * 即将添加的功能：根据中/英文切换不同的帮助文档。
			 **/
			if(NAME == "imp"){
				window.open("/TAX/resources/help/index.html"+"#"+ID);
			}else if(NAME == "exp"){
				window.open("/TAX/resources/help/export.html"+"#"+ID);
			}else if(NAME == "dea"){
				window.open("/TAX/resources/help/handle.html"+"#"+ID);
			}else if(NAME == "mda"){
				window.open("/TAX/resources/help/mdata.html"+"#"+ID);
			}else if(NAME == "rep"){
				window.open("/TAX/resources/help/report.html"+"#"+ID);
			}else if(NAME == "set"){
				window.open("/TAX/resources/help/setting.html"+"#"+ID);
			}else{
				window.open("/TAX/resources/help/index.html");
			}
//			window.open("/TAX/resources/help/template.html");
		}
	},
	init: function(application) {
		this.control({
			"button": {
                click: this.onButtonClick
           }
		});
	}
});